sciright.hint = "Sets the right edge of the clipping shape. If rotation is enabled, sets the center of the right edge.";
scitop.caption = "Clipping Top Edge";
scitop.default = (0,0);
scitop.hint = "Sets the top edge of the clipping shape. Has no effect for Circle and Square clipping shapes." ;// If ; skewing is enabled, sets the center of the ; top edge."
rotation.hint = "If enabled, you can use the Right Edge setting to also select a rotation for the clipping shape.";
// param skewing
// caption = "Allow Skewing"
// default = FALSE
// hint = "If enabled, you can use the Top Edge setting ; to also select a skewing for the clipping shape."
// endparam
sciinside.caption = "Clipping Region";
sciinside.default = 1;
sciinside.enum = "inside\noutside";
relative.caption = "Screen-Relative";
relative.default = FALSE;
relative.hint = "If set, all clipping coordinates are relative to the fractal window. This will leave the clipping shape intact while zooming, but make it harder to enter coordinates for clipping.";
}
}
dmj-EggScissors {
//
// Special Egg Scissors Transform
// This performs much the same function as the
// general clipping transform, but uses an egg
// shape.
//
complex c;
parameter complex eggcenter;
parameter bool centermove;
complex r;
parameter real Parm_angle;
parameter real aspect;
real d;
parameter real diameter;
parameter real eggorder;
parameter bool egginside;
parameter real threshold;
void transform(void)
{
c = eggcenter;// assume egg center is fixed
if ((centermove))
{// relative egg center requested
c = center;// egg center is image center
}
r = (0,1) ^ (Parm_angle / 90.0);// rotation vector
z = (pixel-c) * r;// apply translation and rotation
z = real(z) + flip(imag(z) * aspect);// apply aspect
d = (cabs(z-flip(diameter)*2) + cabs(z)*eggorder*0.5) / (eggorder+1);
if ((egginside))
{// want solid inside
if ((d < threshold))
{// point is inside egg
solid = true;// color it solid
}
}
else
{
// want solid outside
if ((d > threshold))
{// point is outside egg
solid = true;
}
}
}
void description(void)
{
this.title = "Egg Scissors";
this.helpfile = "dmj-pub\dmj-pub-uf-egg.htm";
eggorder.caption = "Egginess";
eggorder.default = 3.0;
eggorder.hint = "Adjusts how non-circular the curve is.";
eggcenter.caption = "Egg Center";
eggcenter.default = (0,0);
eggcenter.hint = "Sets the location of one focus of the egg shape.";
centermove.caption = "Use Screen Center";
centermove.default = TRUE;
centermove.hint = "If set, the egg focus will be at the center of the window, regardless of the Egg Center setting.";
egginside.caption = "Solid Inside";
egginside.default = FALSE;
egginside.hint = "If set, the inside of the egg will be solid. Otherwise, the outside of the egg will be solid.";
aspect.caption = "Aspect Ratio";
aspect.default = 1.0;
aspect.min = 0.0000000001;
aspect.hint = "This is how square the egg curve is. You can distort the curve by using a value other than 1.0.";
threshold.caption = "Threshold";
threshold.default = 0.5;
threshold.min = 0;
threshold.hint = "This is the distance to the edge of the egg curve.";
diameter.caption = "Diameter";
diameter.default = 0.5;
diameter.hint = "This is the distance between focal points of the egg curve.";
Parm_angle.caption = "Rotation";
Parm_angle.default = 0.0;
Parm_angle.hint = "This is the angle, in degrees, that the egg curve should be rotated.";
}
}
dmj-fBm-Clipping {
//
// fBm-based clipping.
// This performs clipping based on fBm textures.
//
complex r;
parameter real Parm_angle;
complex r2;
parameter real anglestep;
complex p;
parameter real scale;
parameter complex offset;
real sum;
real freq;
int i;
parameter real octaves;
real bx0;
real by0;
real bx1;
real by1;
real rx0;
real ry0;
real rx1;
real ry1;
real b00;
parameter real power;
real b10;
real b01;
real b11;
real g_b00_0;
real g_b10_0;
real g_b01_0;
real g_b11_0;
real g_b00_1;
real g_b10_1;
real g_b01_1;
real g_b11_1;
real d;
real u1;
real v1;
real u2;
real v2;
real sx;
real sy;
real a;
real b;
parameter real step;
parameter int above;
parameter real threshold;
void transform(void)
{
r = (0,1) ^ (Parm_angle / 90.0);
r2 = (0,1) ^ (anglestep / 90.0);
// complex r3 = (0,1) ^ (@distangle / 90.0)
p = pixel * scale * r + offset;
sum = 0.0;
freq = 1.0;
i = octaves;
while ((i > 0))
{
// determine integer coordinate for corners of square
// surrounding p
bx0 = floor(real(p)) % 256;
by0 = floor(imag(p)) % 256;
if ((bx0 < 0))
{
bx0 = bx0 + 256;
}
if ((by0 < 0))
{
by0 = by0 + 256;
}
bx1 = (bx0 + 1) % 256;
by1 = (by0 + 1) % 256;
rx0 = real(p) - floor(real(p));
ry0 = imag(p) - floor(imag(p));
rx1 = rx0 - 1;
ry1 = ry0 - 1;
// create a "random" index for each corner
// (this is where Intel's version differs from Perlin's;
// I used Intel's version because it doesn't require a
// pre-computed random table, which is difficult to manage
// in UF.)
b00 = (bx0^power % 65536 + by0)^power % 65536;
b10 = (bx1^power % 65536 + by0)^power % 65536;
b01 = (bx0^power % 65536 + by1)^power % 65536;
b11 = (bx1^power % 65536 + by1)^power % 65536;
// produce a "random" vector for each corner
g_b00_0 = (b00)^power*0.25 % 512 - 256;
g_b10_0 = (b10)^power*0.25 % 512 - 256;
g_b01_0 = (b01)^power*0.25 % 512 - 256;
g_b11_0 = (b11)^power*0.25 % 512 - 256;
g_b00_1 = (b00+1)^power*0.25 % 512 - 256;
g_b10_1 = (b10+1)^power*0.25 % 512 - 256;
g_b01_1 = (b01+1)^power*0.25 % 512 - 256;
g_b11_1 = (b11+1)^power*0.25 % 512 - 256;
// normalize each vector
d = 0.0;//
d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1));
g_b00_0 = g_b00_0 * d;
g_b00_1 = g_b00_1 * d;
d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1));
g_b10_0 = g_b10_0 * d;
g_b10_1 = g_b10_1 * d;
d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1));
g_b01_0 = g_b01_0 * d;
g_b01_1 = g_b01_1 * d;
d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1));
g_b11_0 = g_b11_0 * d;
g_b11_1 = g_b11_1 * d;
// produce colors for each corner
u1 = rx0 * g_b00_0 + ry0 * g_b00_1;
v1 = rx1 * g_b10_0 + ry0 * g_b10_1;
u2 = rx0 * g_b01_0 + ry1 * g_b01_1;
v2 = rx1 * g_b11_0 + ry1 * g_b11_1;
// interpolate between corners using
// bilinear filtering
sx = sqr(rx0) * (3 - rx0*2);
sy = sqr(ry0) * (3 - ry0*2);
a = u1 + sx*(v1-u1);
b = u2 + sx*(v2-u2);
sum = sum + (a + sy*(b-a))*freq;
freq = freq * step;
p = p * r2 / step;
i = i - 1;
}
if ((above == 0))
{
if ((sum > threshold))
{
solid = true;
}
}
else if ((above == 1))
{
if ((sum < threshold))
{
solid = true;
}
}
// IF (sum > @threshold && @above == 0)
// #solid = true
// ELSEIF (sum < @threshold && @above == 1)
// #solid = true
// ENDIF
}
void description(void)
{
this.title = "fBm Clipping";
this.helpfile = "dmj-pub\dmj-pub-uf-fbmclip.htm";
threshold.caption = "Threshold";
threshold.default = 0.0;
threshold.hint = "Sets the threshold, above or below which points will be clipped.";
above.caption = "Clipping Region";
above.default = 0;
above.enum = "above threshold\nbelow threshold";
above.hint = "Set whether points above or below the threshold value will be clipped.";
offset.caption = "Noise Offset";
offset.default = (0,0);
offset.hint = "This is the offset of the pattern. You can use this to shift the pattern around on the complex plane.";
scale.caption = "Noise Scale";
scale.default = 1.0;
scale.hint = "This is the overall scale of the noise.";
Parm_angle.caption = "Noise Rotation";
Parm_angle.default = 0.0;
Parm_angle.hint = "This is the angle, in degrees, of the noise.";
step.caption = "Noise Scale Step";
step.default = 0.5;
step.hint = "This is the step in scale between noise iterations.";
anglestep.caption = "Noise Rotation Step";
anglestep.default = 37.0;
anglestep.hint = "This is the angle, in degrees, to rotate between noise iterations.";
octaves.caption = "Noise Octaves";
octaves.default = 7;
octaves.min = 1;
octaves.hint = "This is the number of iterations of the noise formula.";
power.caption = "Noise Exponent";
power.default = 2.0;
power.hint = "This is the exponent used to scramble numbers.";
}
}
dmj-fBm-Glass1 {
//
// fBm-based glass distortion.
// This provides one-dimensional distortion based
// on fBm textures.
//
complex c;
parameter complex distcenter;
parameter bool centermove;
complex r;
parameter real Parm_angle;
complex r2;
parameter real anglestep;
complex r3;
parameter real distangle;
complex p;
parameter real scale;
parameter complex offset;
real sum;
real freq;
complex v;
int i;
parameter real octaves;
real bx0;
real by0;
real bx1;
real by1;
real rx0;
real ry0;
real rx1;
real ry1;
real b00;
parameter real power;
real b10;
real b01;
real b11;
real g_b00_0;
real g_b10_0;
real g_b01_0;
real g_b11_0;
real g_b00_1;
real g_b10_1;
real g_b01_1;
real g_b11_1;
real d;
real u1;
real v1;
real u2;
real v2;
real sx;
real sy;
real a;
real b;
parameter real step;
parameter int style;
parameter real distortion;
void transform(void)
{
c = distcenter;
if ((centermove))
{
c = center;
}
r = (0,1) ^ (Parm_angle / 90.0);
r2 = (0,1) ^ (anglestep / 90.0);
r3 = (0,1) ^ (distangle / 90.0);
p = pixel * scale * r + offset;
sum = 0.0;
freq = 1.0;
v = (0,0);
i = octaves;
while ((i > 0))
{
// determine integer coordinate for corners of square
// surrounding p
bx0 = floor(real(p)) % 256;
by0 = floor(imag(p)) % 256;
if ((bx0 < 0))
{
bx0 = bx0 + 256;
}
if ((by0 < 0))
{
by0 = by0 + 256;
}
bx1 = (bx0 + 1) % 256;
by1 = (by0 + 1) % 256;
rx0 = real(p) - floor(real(p));
ry0 = imag(p) - floor(imag(p));
rx1 = rx0 - 1;
ry1 = ry0 - 1;
// create a "random" index for each corner
// (this is where Intel's version differs from Perlin's;
// I used Intel's version because it doesn't require a
// pre-computed random table, which is difficult to manage
// in UF.)
b00 = (bx0^power % 65536 + by0)^power % 65536;
b10 = (bx1^power % 65536 + by0)^power % 65536;
b01 = (bx0^power % 65536 + by1)^power % 65536;
b11 = (bx1^power % 65536 + by1)^power % 65536;
// produce a "random" vector for each corner
g_b00_0 = (b00)^power*0.25 % 512 - 256;
g_b10_0 = (b10)^power*0.25 % 512 - 256;
g_b01_0 = (b01)^power*0.25 % 512 - 256;
g_b11_0 = (b11)^power*0.25 % 512 - 256;
g_b00_1 = (b00+1)^power*0.25 % 512 - 256;
g_b10_1 = (b10+1)^power*0.25 % 512 - 256;
g_b01_1 = (b01+1)^power*0.25 % 512 - 256;
g_b11_1 = (b11+1)^power*0.25 % 512 - 256;
// normalize each vector
d = 0.0;//
d = 1 / sqrt(sqr(g_b00_0) + sqr(g_b00_1));
g_b00_0 = g_b00_0 * d;
g_b00_1 = g_b00_1 * d;
d = 1 / sqrt(sqr(g_b10_0) + sqr(g_b10_1));
g_b10_0 = g_b10_0 * d;
g_b10_1 = g_b10_1 * d;
d = 1 / sqrt(sqr(g_b01_0) + sqr(g_b01_1));
g_b01_0 = g_b01_0 * d;
g_b01_1 = g_b01_1 * d;
d = 1 / sqrt(sqr(g_b11_0) + sqr(g_b11_1));
g_b11_0 = g_b11_0 * d;
g_b11_1 = g_b11_1 * d;
// produce colors for each corner
u1 = rx0 * g_b00_0 + ry0 * g_b00_1;
v1 = rx1 * g_b10_0 + ry0 * g_b10_1;
u2 = rx0 * g_b01_0 + ry1 * g_b01_1;
v2 = rx1 * g_b11_0 + ry1 * g_b11_1;
// interpolate between corners using
// bilinear filtering
sx = sqr(rx0) * (3 - rx0*2);
sy = sqr(ry0) * (3 - ry0*2);
a = u1 + sx*(v1-u1);
b = u2 + sx*(v2-u2);
sum = sum + (a + sy*(b-a))*freq;
freq = freq * step;
p = p * r2 / step;
i = i - 1;
}
if ((style == 0))
{// radial distortion
v = (pixel-c)/cabs(pixel-c) * r3;// use vector based on angle to distortion center
}
else if ((style == 1))
{// linear distortion
v = r3;// just use rotation vector
}
pixel = pixel + v * sum*0.5*distortion;
}
void description(void)
{
this.title = "fBm Glass 1";
this.helpfile = "dmj-pub\dmj-pub-uf-fbmg1.htm";
distortion.caption = "Distortion Strength";
distortion.default = 1.0;
distortion.hint = "This is the amount the noise distorts the image.";
style.caption = "Distortion Style";
style.default = 0;
style.enum = "radial\nlinear";
style.hint = "This selects whether the distortion will be focused around a single point, or directed along a line.";
distangle.caption = "Distortion Angle";
distangle.default = 0.0;
distangle.hint = "This is the angle to rotate the distortion.";
distcenter.caption = "Distortion Center";
distcenter.default = (0,0);
distcenter.hint = "Sets the center of distortion. If Use Screen Center is set, this item is ignored.";
centermove.caption = "Use Screen Center";
centermove.default = TRUE;
centermove.hint = "If set, distortion will be around the center of the window, regardless of the Distortion Center setting.";
offset.caption = "Noise Offset";
offset.default = (0,0);
offset.hint = "This is the offset of the pattern. You can use this to shift the pattern around on the complex plane.";
scale.caption = "Noise Scale";
scale.default = 1.0;
scale.hint = "This is the overall scale of the noise.";
Parm_angle.caption = "Noise Rotation";
Parm_angle.default = 0.0;
Parm_angle.hint = "This is the angle, in degrees, of the noise.";
step.caption = "Noise Scale Step";
step.default = 0.5;
step.hint = "This is the step in scale between noise iterations.";
anglestep.caption = "Noise Rotation Step";
anglestep.default = 37.0;
anglestep.hint = "This is the angle, in degrees, to rotate between noise iterations.";
octaves.caption = "Noise Octaves";
octaves.default = 7;
octaves.min = 1;
octaves.hint = "This is the number of iterations of the noise formula.";
power.caption = "Noise Exponent";
power.default = 2.0;
power.hint = "This is the exponent used to scramble numbers.";
}
}
dmj-Forces {
//
// This uses the Mosaic algorithm to sprinkle the image
// with "force points" which attract or repel pixels in
// the image. For any given pixel, its final location is
// the sum of all the forces acting on it. You cannot place
// force points manually; they are placed by the same
symreflect.hint = "Style of symmetry. Reflective will always be seamless; left and right may not be. If Slice is selected, only the section that will be mirrored will be shown.";
symcenter.caption = "Symmetry Center";
symcenter.default = (0,0);
symcenter.hint = "Sets the center of symmetry. If Use Screen Center is set, this item is ignored.";
centermove.caption = "Use Screen Center";
centermove.default = TRUE;
centermove.hint = "If set, symmetry will be around the center of the window, regardless of the Symmetry Center setting.";
Parm_angle.caption = "Rotation angle";
Parm_angle.default = 0.0;
Parm_angle.hint = "Sets how much to rotate the fractal (in degrees) before applying symmetry.";
}
}
dmj-LowRes {
//
// Low Resolution Transformation
// This deliberately lowers the resolution of
// the fractal, but it does so by limiting the
// precision of complex numbers, so it is still
// usable with other transformations.
//
complex r;
parameter real Parm_angle;
parameter real xres;
parameter real yres;
void transform(void)
{
r = (0,1) ^ (Parm_angle/90);// complex rotation vector
mostiles.hint = "Sets the number of mosaic tiles. More tiles take longer to render.";
moscenter.caption = "Tiled Area Center";
moscenter.default = (0,0);
moscenter.hint = "Sets the center of the tiled area. The cluster of tiles will be centered at this point.";
centermove.caption = "Use Screen Center";
centermove.default = TRUE;
centermove.hint = "If set, the tiled area center is assumed to be at the center of the window, regardless of the Tiled Area Center setting.";
mosscale.caption = "Tile Density";
mosscale.default = 5.0;
mosscale.hint = "Specifies the overall scale of the tiles. Smaller numbers will pack the tiles together more closely.";
tilescale.caption = "Tile Magnification";
tilescale.default = 0.0;
tilescale.hint = "Specifies the scale of the image within each tile. Use 0 for solid-color tiles, use 1 for no effect.";
tileseams.caption = "Seam Width";
tileseams.default = 0.0;
tileseams.hint = "Sets the width of seams between tiles. If set to 0, then no seam will be calculated (faster).";
usesolid.caption = "Solid Color Use";
usesolid.default = 0;
usesolid.enum = "none\nseams, no gaps\ntiles, no gaps\nseams, with gaps\ntiles, with gaps";
usesolid.hint = "Sets what the solid color will be used for.";
mosforce.caption = "Force Tiles to Origin";
mosforce.default = 0.0;
mosforce.hint = "Forces the center of each tile towards the origin. If zero, has no effect (tiles are centered normally). If one, tiles are fully moved towards the origin.";
mosangle.caption = "Rotation Range";
mosangle.default = 0.0;
mosangle.hint = "Sets the range on rotations for each tile.";
seed1.caption = "Random Seed 1";
seed1.default = 51853571;
seed1.hint = "This is the 'seed' for the random number generator for horizontal positions.";
seed2.caption = "Random Seed 2";
seed2.default = 8072177;
seed2.hint = "This is the 'seed' for the random number generator for vertical positions.";
seed3.caption = "Random Seed 3";
seed3.default = 654187327;
seed3.hint = "This is the 'seed' for the random number generator for rotations.";
}
}
dmj-NovaJulia {
//
// This does a few Nova Julia iterations to warp
// the fractal shape. Try using it with a
// Newton fractal.
//
complex zsquared;
complex zcubed;
complex zold;
int i;
parameter real iters;
parameter complex offset;
parameter real bailout;
parameter complex power;
parameter complex seed;
void transform(void)
{
zsquared = (0,0);
zcubed = (0,0);
zold = (0,0);
i = iters;
z = pixel-offset;
while ((i > 0 && |z-zold| > bailout))
{
if ((power == (3,0)))
{// special optimized routine for power 3
zsquared = sqr(z);
zcubed = zsquared * z;
zold = z;
z = z - (zcubed-1) / (3*zsquared) + seed;
}
else
{
zold = z;
z = z - (z^power-1) / (power * z^(power-1)) + seed;
}
i = i - 1;
}
if ((|z-zold| <= bailout))
{
solid = true;
}
else
{
pixel = z+offset;
}
}
void description(void)
{
this.title = "Nova (Julia)";
this.helpfile = "dmj-pub\dmj-pub-uf-mjpnx.htm";
iters.caption = "Iterations";
iters.default = 4;
iters.hint = "Number of iterations to do before calculating the fractal. Use a small number.";
offset.caption = "Offset";
offset.default = (0,0);
offset.hint = "Offsets the Nova Julia distortion.";
seed.caption = "Julia Seed";
seed.default = (0,0);
seed.hint = "This is the Julia seed, a constant parameter which defines the shape of the fractal.";
power.caption = "Exponent";
power.default = (3,0);
power.hint = "Overall exponent for the equation. (3,0) gives the classic Nova type.";
bailout.caption = "Bailout";
bailout.default = 0.00001;
bailout.hint = "Defines how soon an orbit bails out, i.e. doesn't belong to the Nova Julia set anymore. Bailed-out points will be solid-colored.";
}
}
dmj-Offset {
//
// This transform offsets the fractal with rectangular
// displacement. By itself, it accomplishes nothing that
// cannot be done better by repositioning the fractal.
// However, combined with other transforms it can produce
// some interesting distortions, and it can also be a
// convenience when creating multi-layer fractals.